<template>
  <table-block>
    <template-query
      slot="query"
      :configs="queryListFields"
      inline-item
      @query="handleSearch"
    >
    </template-query>
    <template-table
      :datas="datas"
      is-order-number
      :loading="isLoading"
      :configs="templateTableFields"
      need-mark-prop="status"
      :need-mark-prop-val="-1"
      @refresh="fetchData"
    >
    </template-table>
    <el-pagination
      slot="pagination"
      :current-page="page"
      :page-size="limit"
      background
      layout="total, sizes, prev, pager, next, jumper"
      :total="total"
      @current-change="handlePageChange"
      @size-change="handleLimitChange"
    />
  </table-block>
</template>

<script>
import { getTemplateList } from 'dependencies/api/template'
import { templateTableFields, queryListFields, columns } from './config'
import TablePageMixins from 'modules/mixins/table-page'
export default {
  name: 'AvatarTemplate',
  mixins: [TablePageMixins],
  data() {
    return {
      templateTableFields,
      queryListFields,
      queryParam: {}
    }
  },
  mounted() {
    this.fetchData()
  },
  methods: {
    getDatas() {
      return getOrderList({
        formData: this.queryParam,
        pageIndex: this.page,
        pageSize: this.limit,
        columns: columns
      })
    },
    handleSearch(params) {
      this.queryParam = { ...params }
      this.page = 1
      this.fetchData()
    }
  }
}
</script>
